import org.apache.spark.{SparkConf, SparkContext}

object scala4231 {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf().setAppName("CreateKeyValueRDD").setMaster("local[*]")
    val sc = new SparkContext(conf)
    val rdd = sc.parallelize(List("this ,is a test","how are you","I am fine","can you tell me"))
    val words = rdd.map(x => (x.split(" ")(0),x))
    val result = words.collect()
    result.foreach(println)
    sc.stop()
  }
}